Skip to content

Conversation

jacmet
Copy link
Contributor

@jacmet jacmet commented Oct 2, 2025

For some use cases it can be interesting to know when the eeprom has been written to by the I2C host (E.G. once a stop has been received after a write transaction), so add a "changed" callback.

The existing API for accessing the EEPROM data is not ideal, so add getters for the size and data instead and update the sample the use the new APIs

jacmet added 5 commits October 2, 2025 15:17
For some use cases it can be interesting to know when the eeprom has been
written to by the I2C host (E.G.  once a stop has been received after a
write transaction), so add a "changed" callback.

Multiple EEPROM instances are supported, so pass the device as argument to
the callback.

Signed-off-by: Peter Korsgaard <[email protected]>
For some use cases it can be interesting to know how big the EEPROM is, so
add a getter for it.

Signed-off-by: Peter Korsgaard <[email protected]>
The current functions to access the EEPROM data are not ideal, E.G.:

- eeprom_target_program() is hard coded to write to the beginning of the
  EEPROM data

- eeprom_target_read() reads a single byte, so large overhead and external
  buffering to access the entire data

So as an alternative, simply add a getter for the data.

Signed-off-by: Peter Korsgaard <[email protected]>
It is not very handy that the EEPROM stops responding after 1 second, so
drop that.

Signed-off-by: Peter Korsgaard <[email protected]>
And show the usages of the new _get_size() / _get_data() getters.

Signed-off-by: Peter Korsgaard <[email protected]>
Copy link

sonarqubecloud bot commented Oct 2, 2025

@JarmouniA JarmouniA changed the title Feature/i2c target eeprom extra api Drivers: i2c: target eeprom extra api Oct 2, 2025
@teburd teburd assigned henrikbrixandersen and unassigned teburd Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants